<template>
    <div>
        <h1>工单列表</h1>
        <ul>
            <li v-for="job in jobs" :key="job.id">
                {{ job.id }} - {{ job.productCode }} - {{ job.currentStatus }}
            </li>
        </ul>
    </div>
</template>

<script setup>
import { ref, onMounted } from 'vue';
import axios from 'axios';

const jobs = ref([]);

const fetchJobs = async () => {
    try {
        const response = await axios.get('http://localhost:44207/api/Job/GetJobs');
        jobs.value = response.data;
    } catch (error) {
        console.error('Failed to fetch jobs:', error);
    }
};

onMounted(() => {
    fetchJobs();
});
</script>